package com.example.demo.springdesign;

import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

public class SpELMain {

    public static void main(String[] args) {
//        ExpressionParserTest1();
        ExpressionParserTest2();
    }

    public static void ExpressionParserTest1(){
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression("'Hello World'");
        System.out.println(exp.getValue()+" : "+exp.getExpressionString());
    }

    public static void ExpressionParserTest2(){
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression("'Hello World'.concat('!')");
        System.out.println(exp.getValue()+" : "+exp.getExpressionString());
    }
}
